﻿<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ViewModels="using:LayoutGridview.ViewModels"
    x:Class="LayoutGridview.Views.GridView01"
    mc:Ignorable="d">

    <Page.DataContext>
        <ViewModels:GridView01ViewModel />
    </Page.DataContext>

    <Page.Resources>
        <CollectionViewSource x:Name="MyCsv"
                              d:Source="{Binding Data, Source={d:DesignInstance Type=ViewModels:GridView01ViewModel, IsDesignTimeCreatable=True}}"
                              Source="{Binding Data}" />
    </Page.Resources>

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">

        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="320" />
        </Grid.ColumnDefinitions>

        <TextBlock Style="{StaticResource HeaderTextBlockStyle}" VerticalAlignment="Top" HorizontalAlignment="Left"
                   Margin="120,40,0,100">
            GridView items can be reordered
        </TextBlock>

        <GridView ItemsSource="{Binding Source={StaticResource MyCsv}}" 
                  CanReorderItems="True" CanDragItems="True"
                  AllowDrop="True" Padding="120,140,80,80">
            <GridView.ItemTemplate>
                <DataTemplate>
                    <Grid Background="{Binding Brush}" Height="50" Width="200">
                        <TextBlock FontSize="20" Text="{Binding Text}" 
                                   VerticalAlignment="Center" Margin="11"
                                   Foreground="Gainsboro" />
                        <TextBlock FontSize="20" Text="{Binding Text}" 
                                   VerticalAlignment="Center" Margin="10"
                                   Foreground="Black" />
                    </Grid>
                </DataTemplate>
            </GridView.ItemTemplate>
        </GridView>

        <Rectangle Grid.Column="1" Fill="{StaticResource SemanticZoomButtonPressedBackgroundThemeBrush}" />
        
        <ListView ItemsSource="{Binding Source={StaticResource MyCsv}}" 
                  CanReorderItems="True" CanDragItems="True"
                  AllowDrop="True" Padding="40,40,40,80" Grid.Column="1">
            <ListView.Header>
                <TextBlock Style="{StaticResource HeaderTextBlockStyle}" 
                           Margin="0,0,0,60">ListView</TextBlock>
            </ListView.Header>
            <ListView.ItemTemplate>
                <DataTemplate>
                    <Grid Background="{Binding Brush}" Height="50" Width="220">
                        <TextBlock FontSize="20" Text="{Binding Text}" 
                                   VerticalAlignment="Center" Margin="11"
                                   Foreground="Gainsboro" />
                        <TextBlock FontSize="20" Text="{Binding Text}" 
                                   VerticalAlignment="Center" Margin="10"
                                   Foreground="Black" />
                    </Grid>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

    </Grid>

</Page>